package nl.haemers.math 
{
	import flash.geom.Point;
	/**
	 * ...
	 * @author Jonathan Haemers
	 */
	//Static class with static functions
	public class Trigonometry
	{		
		/**
		 * Calculate distance between two points
		 * Pythagoras
		 * dx = x2 - x1
		 * dy = y2 - y1
		 * 
		 * dist = Math.sqrt(dx*dx + dy*dy);
		 * @param	point1
		 * @param	point2
		 * @return
		 */
		public static function calcDistance(point1:Point, point2:Point) : Number
		{
			var dx:Number = point2.x - point1.x;
			var dy:Number = point2.y - point2.y;
			
			return Math.sqrt( dx * dx + dy * dy);
		}
		
		/**
		 * Convert radians to degrees
		 * @param	radians
		 * @return
		 */
		public static function toDegrees( radians:Number ) : Number
		{
			return (radians != 0) ? (radians * 180 / Math.PI) : 0;
		}
		/**
		 * Convert degrees to radians
		 * @param	degrees
		 * @return
		 */
		public static function toRadians( degrees:Number ) : Number
		{
			return (degrees != 0) ? (degrees * Math.PI / 180) : 0;
		}
		
		
	}

}